<?php
	$this->load->view('admin/common/header',array(
			'_user'=>$_user,
			'modules'=>$modules,
			'pageTitle'=>'广告管理-添加广告',
			//'pageCss'=>'datepick'
	));
	if (empty($adv)) {
		$adv = array('media_type'=>'image');
	}
?>
<script language="javascript">
$(document).ready(function(){
	loadMediaTypeFeild("<?=$adv['media_type']?>");
	//$('.format_date').datepick();
});
function loadMediaTypeFeild(media){
	media = $('#media_type option:selected').val()
	var onids = [];
	
	if(media=='image'){
		onids = ['ad_link','ad_image','ad_image_url'];
	}else if(media=='text'){
		onids = ['ad_link','ad_text'];
	}else if(media=='flash'){
		onids = ['ad_flash','ad_flash_url'];
	}else if(media=='html'){
		onids = ['ad_code'];
	}
 	$('.form_item').hide();
	for(var i = 0;i<onids.length;i++){
		$("#"+onids[i]).show();
	}
}
</script>
<div class="clear tile_bg" id="content">
  <h1><?php if(isset($adv['id'])): ?>编辑广告<?php else:$adv=array();?>添加广告<?php endif;?></h1>
  <div class="form">
    <?=$this->load->view('admin/ads/_form', array('adv'=>$adv))?>
  </div>
</div>
</div>
<?php
	$this->load->view('admin/common/footer');
?>